package com.iking.toolkit.formatdeal.controller;

import com.iking.toolkit.model.Msg;
import com.iking.toolkit.formatdeal.model.dto.WebDealDTO;
import com.iking.toolkit.formatdeal.service.WebsiteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能描述:网页处理接口管理
 *
 * @author: yfl
 * @date: 2025/8/4 13:36
 */
@Slf4j
@Tag(name = "WebsiteController", description = "网页处理接口管理")
@RequestMapping("/website")
@RestController
@Validated
public class WebsiteController {

    @Autowired
    private WebsiteService websiteService;

    @Operation(summary = "网页转pdf")
    @PostMapping("/webToPdf")
    public Msg webToPdf(@RequestBody @Valid WebDealDTO webDealDTO, HttpServletResponse response) {
        return websiteService.webToPdf(webDealDTO,response);
    }
    @Operation(summary = "网页转png")
    @PostMapping("/webToPng")
    public Msg webToPng(@RequestBody @Valid WebDealDTO webDealDTO, HttpServletResponse response) {
        return websiteService.webToPng(webDealDTO,response);
    }

}
